********************************
********* UNGA *****************
********************************
use "UNGA_RepData.dta", clear
tsset ccode year


******************
*** TWO-WAY FE ***
******************

***BASE MODELS

**Pooled

xtreg logvotech solsch demboth i.year, i(ccode) fe robust cluster(ccode)

**Interaction

xtreg logvotech solsch##demboth i.year, i(ccode) fe robust cluster(ccode)
margins, dydx(solsch) at(demboth==1) at(demboth==0) post
margins, coeflegend
test  _b[1.solsch:1bn._at] =  _b[1.solsch:2._at]

xtreg logvotech solsch##demboth i.year, i(ccode) fe robust cluster(ccode)
margins, dydx(demboth) at(solsch==1) at(solsch==0) post
margins, coeflegend
test   _b[1.demboth:1bn._at] =   _b[1.demboth:2._at]


*** CONTROL 1 MODEL
*Note: this is actually control 2 in the do files

** Pooled

xtreg logvotech solsch demboth regtrans allyCW CWend abscincperch10 gdpdrop5 logrealGDPpcG i.year, i(ccode) fe robust cluster(ccode)

**Interaction

xtreg logvotech solsch##demboth regtrans allyCW CWend abscincperch10 gdpdrop5 logrealGDPpcG i.year, i(ccode) fe robust cluster(ccode)
margins, dydx(solsch) at(demboth==1) at(demboth==0) post
margins, coeflegend
test  _b[1.solsch:1bn._at] =  _b[1.solsch:2._at]

xtreg logvotech solsch##demboth regtrans allyCW CWend abscincperch10 gdpdrop5 logrealGDPpcG i.year, i(ccode) fe robust cluster(ccode)
margins, dydx(demboth) at(solsch==1) at(solsch==0) post
margins, coeflegend
test   _b[1.demboth:1bn._at] =   _b[1.demboth:2._at]


*************
*** NO FE ***
*************

***BASE MODELS

**Pooled

reg logvotech solsch demboth, robust cluster(ccode)

**Interaction

reg logvotech solsch##demboth, robust cluster(ccode)
margins, dydx(solsch) at(demboth==1) at(demboth==0) post
margins, coeflegend
test  _b[1.solsch:1bn._at] =  _b[1.solsch:2._at]

reg logvotech solsch##demboth, robust cluster(ccode)
margins, dydx(demboth) at(solsch==1) at(solsch==0) post
margins, coeflegend
test   _b[1.demboth:1bn._at] =   _b[1.demboth:2._at]


*** CONTROL 1 MODEL
*Note: this is actually control 2 in the do files

** Pooled

reg logvotech solsch demboth regtrans allyCW CWend abscincperch10 gdpdrop5 logrealGDPpcG, robust cluster(ccode)

**Interaction

reg logvotech solsch##demboth regtrans allyCW CWend abscincperch10 gdpdrop5 logrealGDPpcG, robust cluster(ccode)
margins, dydx(solsch) at(demboth==1) at(demboth==0) post
margins, coeflegend
test  _b[1.solsch:1bn._at] =  _b[1.solsch:2._at]

reg logvotech solsch##demboth regtrans allyCW CWend abscincperch10 gdpdrop5 logrealGDPpcG, robust cluster(ccode)
margins, dydx(demboth) at(solsch==1) at(solsch==0) post
margins, coeflegend
test   _b[1.demboth:1bn._at] =   _b[1.demboth:2._at]




*******************************
********* TRADE  **************
*******************************
use "Trade_RepData.dta", clear
tsset ddyad year

******************
*** TWO WAY FE ***
******************

*****RESTRICTED SAMPLE

***BASIC

**Pooled

xtreg MRdv_rest L.solschdumA_3 L.dembothA i.year, fe cluster(ddyad) robust

**Interaction

xtreg MRdv_rest L.solschdumA_3##L.dembothA i.year, fe cluster(ddyad) robust
margins, dydx(L.solschdumA_3) at(L.dembothA==1) at(L.dembothA==0) post
margins, coeflegend
test  _b[1L.solschdumA_3:1bn._at] =  _b[1L.solschdumA_3:2._at]
xtreg MRdv_rest L.solschdumA_3##L.dembothA i.year, fe cluster(ddyad) robust
margins, dydx(L.dembothA) at(L.solschdumA_3==1) at(L.solschdumA_3==0) post
margins, coeflegend
test _b[1L.dembothA:1bn._at] =  _b[1L.dembothA:2._at]


***CONTROL 1

**Pooled

xtreg MRdv_rest L.solschdumA_3 L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict i.year, fe cluster(ddyad) robust

**Interaction

xtreg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict i.year, fe cluster(ddyad) robust
margins, dydx(L.solschdumA_3) at(L.dembothA==1) at(L.dembothA==0) post
margins, coeflegend
test  _b[1L.solschdumA_3:1bn._at] =  _b[1L.solschdumA_3:2._at]
xtreg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict i.year, fe cluster(ddyad) robust
margins, dydx(L.dembothA) at(L.solschdumA_3==1) at(L.solschdumA_3==0) post
margins, coeflegend
test _b[1L.dembothA:1bn._at] =  _b[1L.dembothA:2._at]


***CONTROL 2

**Pooled

xtreg MRdv_rest L.solschdumA_3 L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict L.gattwto L.pta L.solschdumB_3 L.regtransB L.allyCW2 L.conflictb L.gdpln_a L.gdpln_b i.year, fe cluster(ddyad) robust

**Interaction

xtreg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict L.gattwto L.pta L.solschdumB_3 L.regtransB L.allyCW2 L.conflictb L.gdpln_a L.gdpln_b i.year, fe cluster(ddyad) robust
margins, dydx(L.solschdumA_3) at(L.dembothA==1) at(L.dembothA==0) post
margins, coeflegend
test  _b[1L.solschdumA_3:1bn._at] =  _b[1L.solschdumA_3:2._at]
xtreg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict L.gattwto L.pta L.solschdumB_3 L.regtransB L.allyCW2 L.conflictb L.gdpln_a L.gdpln_b i.year, fe cluster(ddyad) robust
margins, dydx(L.dembothA) at(L.solschdumA_3==1) at(L.solschdumA_3==0) post
margins, coeflegend
test _b[1L.dembothA:1bn._at] =  _b[1L.dembothA:2._at]


*************
*** NO FE ***
*************

*****RESTRICTED SAMPLE

***BASIC

**Pooled

reg MRdv_rest L.solschdumA_3 L.dembothA, cluster(ddyad) robust

**Interaction

reg MRdv_rest L.solschdumA_3##L.dembothA, cluster(ddyad) robust
margins, dydx(L.solschdumA_3) at(L.dembothA==1) at(L.dembothA==0) post
margins, coeflegend
test  _b[1L.solschdumA_3:1bn._at] =  _b[1L.solschdumA_3:2._at]
reg MRdv_rest L.solschdumA_3##L.dembothA, cluster(ddyad) robust
margins, dydx(L.dembothA) at(L.solschdumA_3==1) at(L.solschdumA_3==0) post
margins, coeflegend
test _b[1L.dembothA:1bn._at] =  _b[1L.dembothA:2._at]


***CONTROL 1

**Pooled

reg MRdv_rest L.solschdumA_3 L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict, cluster(ddyad) robust

**Interaction

reg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict, cluster(ddyad) robust
margins, dydx(L.solschdumA_3) at(L.dembothA==1) at(L.dembothA==0) post
margins, coeflegend
test  _b[1L.solschdumA_3:1bn._at] =  _b[1L.solschdumA_3:2._at]
reg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict, cluster(ddyad) robust
margins, dydx(L.dembothA) at(L.solschdumA_3==1) at(L.solschdumA_3==0) post
margins, coeflegend
test _b[1L.dembothA:1bn._at] =  _b[1L.dembothA:2._at]



***CONTROL 2

**Pooled

reg MRdv_rest L.solschdumA_3 L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict L.gattwto L.pta L.solschdumB_3 L.regtransB L.allyCW2 L.conflictb L.gdpln_a L.gdpln_b, cluster(ddyad) robust

**Interaction

reg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict L.gattwto L.pta L.solschdumB_3 L.regtransB L.allyCW2 L.conflictb L.gdpln_a L.gdpln_b, cluster(ddyad) robust
margins, dydx(L.solschdumA_3) at(L.dembothA==1) at(L.dembothA==0) post
margins, coeflegend
test  _b[1L.solschdumA_3:1bn._at] =  _b[1L.solschdumA_3:2._at]
reg MRdv_rest L.solschdumA_3##L.dembothA L.regtransA L.allyCW1 L.CWend L.gdpdrop5 L.conflicta L.armconflict L.gattwto L.pta L.solschdumB_3 L.regtransB L.allyCW2 L.conflictb L.gdpln_a L.gdpln_b, cluster(ddyad) robust
margins, dydx(L.dembothA) at(L.solschdumA_3==1) at(L.solschdumA_3==0) post
margins, coeflegend
test _b[1L.dembothA:1bn._at] =  _b[1L.dembothA:2._at]

